home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000096_icon-group-sender _Fri Oct 24 13:14:12 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by cheltenham.cs.arizona.edu (8.8.7/8.8.7) with SMTP id NAA28879
for <icon-group-addresses@cheltenham.CS.Arizona.EDU>; Fri, 24 Oct 1997 13:14:11 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA24963; Fri, 24 Oct 1997 13:14:11 -0700
Date: Fri, 24 Oct 1997 09:01:17 -0700
From: swampler@noao.edu (Steve Wampler)
Subject: Re: tabulating values
To: icon-group@cs.arizona.edu
Message-Id: <swampler-9709241601.AA000212087@orpheus.gemini.edu>
In-Reply-To: <62p3uq$sup$1@vishnu.jussieu.fr>
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Marc ESPIE wrote:
>
> Come on guys, when somebody asks a rather simple question, giving him
> an half-baked program that doesn't work won't probably give him a clue
> about what's wrong.
>
> Stuart: I'm curious about the way you're using Icon. If you're truely
> stuck with the program library as far as programming goes, you're only
> using a small part of Icon. How about trying to learn and program ?
Ok, here's one that works as I understand the problem:
procedure main()
counts := table(0)
every counts[genNum()] +:= 1
counts := sort(counts,2)
every i := *counts to 1 by -1 do {
write(counts[i][1],"\t",counts[i][2])
}
end
procedure genNum()
every line := !&input do
line ? {
while tab(upto(&digits)) do
suspend tab(many(&digits)) \ 1
}
end
Also, you can adapt the countwords() procedure given on page 82
of the 3rd edition of the Icon book to do most of the work by
changing &letters to &digits. Of course, you really should
rename the procedure also!
--
Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
O Sibile, si ergo, fortibus es inero.
Nobile, demis trux. Demis phulla causan dux.